In an existing operating network, there is a manner of performing charging based on directional-traffic statistics collection, that is, a service provider pays a traffic fee generated when user equipment uses this service. In this charging solution, calculation may be performed according to an IP address accessed by the user equipment. For example, a gateway device maintains an IP address list including IP addresses provided by the service provider, and collects, according to the IP address list, statistics about traffic generated when each of the IP addresses is accessed. Alternatively, calculation may be performed according to a URL (Uniform Resource Locator) accessed by the user equipment. A gateway device maintains a URL list including URLs provided by the service provider, and collects, according to the URL list, statistics about traffic generated when each of the URLs is accessed. An IP address of the service provider is distributed by an IP address distribution server, the IP address distribution server is likely to provide a shared IP address for multiple service providers, and the gateway device is likely to collect statistics about traffic generated when the user equipment uses a service of another service provider and report the statistics about traffic to a charging server. Therefore, in the solution of performing charging according to an IP address, a charging misoperation is performed on the service provider. The HTTP protocol needs to be used in URL access. In this case, when the user equipment uses a service of the service provider in another non-HTTP protocol access manner, traffic generated in this access process cannot be counted as traffic of the service provider.
To avoid a charging misoperation or omission of statistics, a method for collecting statistics about directional traffic according to a packet feature is proposed in the prior art. A gateway device analyzes a packet used for accessing the service provider to obtain a packet feature, and uses, as a packet used for accessing the service provider, a packet in which the packet feature is detected. According to this method, the charging misoperation or the omission of statistics can be better avoided. However, when another third-party application cracks and simulates the packet feature to use a service of another service provider, after detecting the packet feature, the gateway device directly counts generated traffic as traffic of the service provider, and reports the traffic to a charging server. To avoid this fraud behavior, once a phenomenon that the packet feature is fraudulently used is found, the service provider needs to change the packet feature, user equipment needs to update a program used by the user equipment, so as to obtain and use a new packet feature, and the gateway device needs to obtain, by means of re-analyzing, the packet feature for use. This solution is very cumbersome, and the user equipment, a network device, and the service provider need to synchronously perform updating. Therefore, implementation costs are high, and it is difficult to ensure accuracy of a directional-traffic statistics collection operation.